import java.util.Scanner;

public class demo05 {
    public static int i=-1;
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        int ret=dfs(str);
        System.out.println(ret);
    }
    public static int dfs(String str){
        int count=0;
        int max=0;
        while (i<str.length()-1){
            i++;
            if(str.charAt(i)=='('){
                count+=dfs(str);
            } else if (str.charAt(i)=='x') {
                count++;
            }else if (str.charAt(i)=='|'){
                max=Math.max(max,count);
                count=0;
            }else{
                break;
            }
        }
        return Math.max(max,count);
    }
}
